package org.shoukaiseki.supersaiyan.db.inittable.system;

import org.shoukaiseki.inittable.domain.TableColumnInfo;
import org.shoukaiseki.inittable.domain.TableIndexInfo;
import org.shoukaiseki.inittable.service.ITableBuildInfoService;
import org.shoukaiseki.kakaroto.annotation.TableBuild;

import java.util.List;

import static org.shoukaiseki.inittable.utils.SksColumnCamelCaseCommon.uniqueId;
import static org.shoukaiseki.inittable.utils.TableColumnInfoBuilder.column;
import static org.shoukaiseki.inittable.utils.TableIndexInfoBuilder.uniqueIndex;
import static org.shoukaiseki.inittable.utils.TableInfoUtils.tableColumns;
import static org.shoukaiseki.inittable.utils.TableInfoUtils.tableIndexs;

@TableBuild(name = "sys_dict_type", comment = "字典类型表",version = 1)
public class SysDictTypeInitTableInfo implements ITableBuildInfoService {


    @Override
    public List<TableColumnInfo> tableColumnInfoList(){
        List<TableColumnInfo> table = tableColumns(
                uniqueId("dict_id","字典主键"),
                column("	dict_name   varchar(100) default ''  null comment '字典名称',"),
                column("	dict_type   varchar(100) default ''  null comment '字典类型',"),
                column("	status      char         default '0' null comment '状态（0正常 1停用）',"),
                column("  sync_flag   int(12)      default '1' not null comment '同步标识',")
                        .description("同步标识,默认1: 初始化字典时将,删除字典数据,和字典类型后重建,否则不删除,在前端修改字典信息后,该值变为0"),
                column("	create_by   varchar(64)  default ''  null comment '创建者',"),
                column("	create_time datetime                 null comment '创建时间',"),
                column("	update_by   varchar(64)  default ''  null comment '更新者',"),
                column("	update_time datetime                 null comment '更新时间',"),
                column("	remark      varchar(500)             null comment '备注',"),
                column("    admin_flag  char(1)         default '0'       not null comment '1:仅管理员可见',"),

                null
        );

        return table;
    }

    @Override
    public List<TableIndexInfo> tableIndexInfoList() {
        return tableIndexs(
                uniqueIndex("udx_dict_type").indexColumns("dict_type"),
                null
        );
    }
}
